#include "qqtsysteminfo_win.h"

QQtSystemInfoPrivate::QQtSystemInfoPrivate ( QQtSystemInfo* parent ) : q_ptr ( parent )
{

}

bool QQtSystemInfoPrivate::getOSInfo()
{

}

bool QQtSystemInfoPrivate::getCPUInfo ( TCPUTable& cpuInfo )
{
    SYSTEM_INFO systemInfo;
    GetSystemInfo ( &systemInfo );

    TCPUInfo info;
    info.mCoreNum = systemInfo.dwNumberOfProcessors;
    cpuInfo.mNum = 1;
    cpuInfo.mList.push_back ( info );

    qDebug() << QStringLiteral ( "处理器掩码:" ) << systemInfo.dwActiveProcessorMask;
    qDebug() << QStringLiteral ( "处理器个数:" ) << systemInfo.dwNumberOfProcessors;
    qDebug() << QStringLiteral ( "处理器分页大小:" ) << systemInfo.dwPageSize;
    qDebug() << QStringLiteral ( "处理器类型:" ) << systemInfo.dwProcessorType;
    qDebug() << QStringLiteral ( "最大寻址单元:" ) << systemInfo.lpMaximumApplicationAddress;
    qDebug() << QStringLiteral ( "最小寻址单元:" ) << systemInfo.lpMinimumApplicationAddress;
    qDebug() << QStringLiteral ( "处理器等级:" ) << systemInfo.wProcessorLevel;
    qDebug() << QStringLiteral ( "处理器版本:" ) << systemInfo.wProcessorRevision;
}

bool QQtSystemInfoPrivate::getMEMInfo ( TMemTable& memInfo )
{
    MEMORYSTATUSEX statex;
    statex.dwLength = sizeof ( statex );
    GlobalMemoryStatusEx ( &statex );

    memInfo.mTotalSize = statex.ullTotalPhys;
    memInfo.mAvalableSize = statex.ullAvailPhys;
    memInfo.mNum = 1;

    qDebug() << QStringLiteral ( "物理内存使用率:" ) << statex.dwMemoryLoad;
    qDebug() << QStringLiteral ( "物理内存总量:" ) << statex.ullTotalPhys / MB;
    qDebug() << QStringLiteral ( "可用的物理内存:" ) << statex.ullAvailPhys / MB;
    qDebug() << QStringLiteral ( "系统页面文件大小:" ) << statex.ullTotalPageFile / MB;
    qDebug() << QStringLiteral ( "系统可用页面文件大小:" ) << statex.ullAvailPageFile / MB;
    qDebug() << QStringLiteral ( "虚拟内存总量:" ) << statex.ullTotalVirtual / MB;
    qDebug() << QStringLiteral ( "可用的虚拟内存:" ) << statex.ullAvailVirtual / MB;
    qDebug() << QStringLiteral ( "保留（值为0）:" ) << statex.ullAvailExtendedVirtual / MB;
    return true;
}

bool QQtSystemInfoPrivate::getDISKInfo ( TDiskTable& diskInfo )
{
    return true;
}
